import cv2
import numpy as np
from mpmath.libmp import normalize

img =cv2.imread("../images/demo2.png")
print(img.shape,type(img))
#均值滤波
img_blur  = cv2.blur(
    img,
    ksize=(3,3)
)
#方框滤波
img_box = cv2.boxFilter(
    img,
    ddepth = -1,
    ksize=(3,3),
    normalize = False
)
#高斯滤波
img_gaussian =  cv2.GaussianBlur(
               img,
              ksize=(3,3),
              sigmaX= 13
           )
#中值滤波
img_median =cv2.medianBlur(
    img,
    ksize=3,
)
#双边滤波
img_bilateral     =cv2.bilateralFilter(
    img,
    d = 5,
    sigmaColor= 70,
    sigmaSpace= 70
)

#图像就是一个ndarray，虽然cv2没有提供子图布局函数，但是我们可以使用
# plt.subplot()
# np.hstack()
# 来实现子图布局
image_stack = np.hstack([img,img_blur,img_box,img_gaussian,img_median,img_bilateral ])
cv2.imshow("image vs ",image_stack)
cv2.waitKey(0)